/**
 * Created by jt on 2017/5/6.
 */
import "./index.less";
import "../../../unit/common/js/bootstrap_js/jquery.min.js";
import "../../../unit/common/js/bootstrap_js/ckeditor.js";
import "../../../unit/common/js/bootstrap_js/select2.min.js";
import "../../../unit/common/js/bootstrap_js/jquery.multi-select.js";
// import "../../../unit/common/js/bootstrap_js/chosen.jquery.min.js";
import "../../../unit/common/js/bootstrap_js/jquery.dataTables.js";
import "../../../unit/common/js/bootstrap_js/form-samples.js";
import "../../../unit/common/js/bootstrap_js/table-editable.js";
import "../../../unit/common/js/bootstrap_js/bootstrap-datetimepicker.js";
import "../../../unit/common/js/bootstrap_js/bootstrap-datetimepicker.zh-CN.js";
import "../../../unit/common/js/bootstrap_js/form-components.js";

jQuery(document).ready(function() {
    App.init();
    // FormComponents.init();

    jQuery('.logOut').attr('href','../logins/login.html');
    var token = sessionStorage.getItem('token');
    if (token == null || token =='') {
        location.href = HOST_FRT+'/logins/login.html';
    }
    //保存
    jQuery('.subKeep').click(function () {
        let exptNam = jQuery('.exptNam').val();
        let mobNbr = jQuery('.mobNbr').val();
        let exptTtl = jQuery('.exptTtl').val();
        if (exptNam =='') {
            alert('专家姓名不得为空！');
            return;
        }
        if (mobNbr =='') {
            alert('手机号不得为空！');
            return;
        }
        if (exptTtl =='') {
            alert('专家职称不得为空！');
            return;
        }
        let data = {
            "exptNam":exptNam,
            "mobNbr":mobNbr,
            "exptTtl": exptTtl
        };
        console.log(data);

        jQuery.ajax({
            url: HOST_ADDR+'/cpmp/expt/add',
            type: 'post',
            data: JSON.stringify(data),
            dataType: 'json',
            contentType:"application/json",
            headers: {
                'access_token': token,'login_type':'ums'
            },
            success: function(resp){
                if (!resp.success) {
                    console.log(resp.msgCod+' '+resp.msgInf);
                    return;
                }
                    console.log(resp);
                // //页面跳转到index
                alert('新增成功');
//						location.href = 'proj_list.html';
            },
            error:function(err){
                console.log(err);
            }
        });
    });

});